<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>网络状态</title>
    <style type='text/css'>
         * {
            margin: 0;
            padding: 0;
            text-align: center;
        }
        .home {
            text-align: center;
        }
        img {
            width: 80px;
            height: 50px;
        }
    </style>
</head>
<body>
    <img onerror='reSetImgUrl(this, this.src , 3)' src='远端的图片地址'/> 
    <script>
        function reSetImgUrl(imgObj,imgSrc,maxErrorNum){  
            if(maxErrorNum > 0){  
                    imgObj.onerror=function(){  
                        reSetImgUrl(imgObj,imgSrc,maxErrorNum-1);  
                    };  
                    setTimeout(function(){  
                        imgObj.src=imgSrc;  
                    },500);  
                }else{  
                    imgObj.onerror=null;  
                    imgObj.src="https://positivethinking.tech/wp-content/uploads/2021/01/Vue.js-as-en-enterprise-solution-France-Belgium-Luxembourg-germany-800x533.jpg";  
                }  
        
            }  
    </script>
</body>
</html>